home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-09 | 573 b | 22 lines | [TEXT/KAHL] |
- /*
- Cast.h
-
- Provides a debug macro which casts an object, and asserts that the
- object is a member of the class cast to.
-
- */
-
- // thanks to a unknown contributor to "comp.sys.mac.oop.tcl" for this file -ES
-
-
- #ifdef __TCL_DEBUG__
- static CObject * gCastObject;
- #define CAST( object, class ) (gCastObject = (CObject*)(object), ASSERT(member(gCastObject, class)), (class *) (gCastObject))
- #else
- #define CAST( object, class ) ((class *) (object))
- #endif
-
-
- #define CheckedCast(obj,type) \
- (((obj) && member((obj),type)) ? ((type *) (obj)) : nil)
-